import React from "react";
import {AppstoreOutlined} from '@ant-design/icons';
import {Menu} from "antd";
import './menu.scss'
import MenuItem from "antd/es/menu/MenuItem";
import {getQueryVariable} from '../../utils/routerUtils'


function MyMenu(props) {

    const {SubMenu} = Menu;

    const handleClick = (e) => {
        window.location.href = '../' + e.key + "?menu=" + e.key
    }

    return (
        <div className={'menu-container'}>
            <div className={'menu-title'}>
                停车场管理系统
            </div>

            <Menu
                onClick={handleClick}
                style={{width: 220}}
                defaultSelectedKeys={[getQueryVariable("menu")]}
                defaultOpenKeys={['']}
                mode="inline">

                <MenuItem eventKey={''}>首页</MenuItem>

                <MenuItem eventKey={'todo'}>待办中心</MenuItem>

                <SubMenu icon={<AppstoreOutlined/>} title="停车场备案管理" key={'1'}>
                    <MenuItem eventKey={'add_record'}>新增备案</MenuItem>
                    <MenuItem eventKey={'record_manage'}>我的备案</MenuItem>
                </SubMenu>

                <MenuItem eventKey={'parking_manage'}>停车场管理</MenuItem>

                <MenuItem eventKey={'parking_unit'}>停车单位管理</MenuItem>

                <MenuItem eventKey={'user_manage'}>停车用户管理</MenuItem>

                <MenuItem eventKey={'parking_search'}>停车场查询</MenuItem>

                <MenuItem eventKey={'my_info'}>我的资讯</MenuItem>

                <MenuItem eventKey={'personal'}>个人中心</MenuItem>

            </Menu>
        </div>
    )
}

export default MyMenu